<script setup lang="ts">
import {businesslist} from "@/api/more";
import {ref} from "vue";
import {useRouter} from "vue-router";
const PubishList=ref([])
businesslist().then(res=>{
    console.log(res.rows)
    PubishList.value=res.rows
})
// 跳转到相应得详情页
const router = useRouter();
function PublishDetail(item:any) {
    router.push({
        path:'/PublishDetail',
        query:{
            item:item
        }
    })
}
</script>

<template>
<div>
    <div class="applyDetail" v-for="(item) in PubishList" :key="item.releaseId" @click="PublishDetail(JSON.stringify(item))">
        <div>
            <div class="company"><span>{{item.title}}</span>
                <div>
                    <button class="examined" v-if="item.auditState=='0'">待审核</button>
                    <button class="pass" v-else-if="item.auditState=='1'" >已通过</button>
                    <button class="NotPass" v-else>未通过</button>
                    <img src="../images/下一步.png" height="12px" width="10px"></div>
            </div>
        </div>
        <p>{{ item.updatedTime }}</p>
        <div class="BusinessDescription">
            <p>业务说明:</p>
            <p>{{ item.intro }}</p>
        </div>
        <div class="operation">
            <button>编辑</button>
            <button>删除</button>
        </div>
    </div>
    <p class="bottom">没有更多数据了~</p>
</div>
</template>

<style scoped lang="less">
.applyDetail{
  padding: 15px;
  background-color: white;
  margin: 10px 10px 0 10px;
  border-radius: 10px;

}
.company {
  display: flex;
  justify-content: space-between;
  align-items: center;
  span {
    font-weight: 600;
    width: 70%;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
    white-space: nowrap;
  }
}
.BusinessDescription{
  padding: 10px;
  background-color: #F4F4F6;
  border-radius: 5px;
  p:last-child{
    color: gray;
  }
}
.operation{
  margin-top: 10px;
  display: flex;
  justify-content: space-evenly;
  button{
    color: white;
    background-color: #EEB7BE;
    font-size: 12px;
    border: 1px solid red;
    padding: 2px 50px;
    border-radius: 3px;
  }
}
.bottom {
  width: 100%;
  text-align: center;
  margin-top: 20px;
  padding-bottom: 10px;
}
.pass{
    border: 1px solid gray;
    background-color: white;
    color: lightgray;
    font-size: 14px;
    margin-right: 10px;
}
.examined{
    border: 1px solid orange;
    background-color: white;
    color: orange;
    font-size: 14px;
    margin-right: 10px;
}
.NotPass{
    border: 1px solid red;
    background-color: white;
    color: red;
    font-size: 14px;
    margin-right: 10px;
}

</style>